using System;
using System.Collections;
namespace InfoJetSoft.Service.ManagedCode
{
	/// <summary>
	/// Summary description for DataObjects.
	/// </summary>
	public class DataObjects : Microsoft.Office.Interop.InfoPath.SemiTrust.DataObjectsCollection
	{
		private InfoJetSoft.Service.Entity.Form form = null;
		private ArrayList dataObjectList = new ArrayList();

		public DataObjects( InfoJetSoft.Service.Entity.Form frm )
		{
			this.form = frm;
			foreach( InfoJetSoft.Service.Entity.DataObject innerDataObject in this.form.Manifest.DataObjectList )
			{
				DataObject dataObject = new DataObject( this.form, innerDataObject );
				this.dataObjectList.Add( dataObject );
			}
		}

		public IEnumerator GetEnumerator()
		{
			return this.dataObjectList.GetEnumerator();
		}

		public int Count 
		{ 
			get
			{
				return this.dataObjectList.Count;
			}
		}
		
		public Microsoft.Office.Interop.InfoPath.SemiTrust.DataObject MyDataObject1
		{
			get
			{
				return this[ "MyDataObject1" ];
			}
		}

		public Microsoft.Office.Interop.InfoPath.SemiTrust.DataObject MyDataObject2
		{
			get
			{
				return this[ "MyDataObject2" ];
			}
		}

		public Microsoft.Office.Interop.InfoPath.SemiTrust.DataObject MyDataObject3
		{
			get
			{
				return this[ "MyDataObject3" ];
			}
		}

		public Microsoft.Office.Interop.InfoPath.SemiTrust.DataObject MyDataObject4
		{
			get
			{
				return this[ "MyDataObject4" ];
			}
		}

		public Microsoft.Office.Interop.InfoPath.SemiTrust.DataObject MyDataObject5
		{
			get
			{
				return this[ "MyDataObject5" ];
			}
		}

		public Microsoft.Office.Interop.InfoPath.SemiTrust.DataObject MyDataObject6
		{
			get
			{
				return this[ "MyDataObject6" ];
			}
		}

		public Microsoft.Office.Interop.InfoPath.SemiTrust.DataObject MyDataObject7
		{
			get
			{
				return this[ "MyDataObject7" ];
			}
		}

		public Microsoft.Office.Interop.InfoPath.SemiTrust.DataObject MyDataObject8
		{
			get
			{
				return this[ "MyDataObject8" ];
			}
		}

		public Microsoft.Office.Interop.InfoPath.SemiTrust.DataObject MyDataObject9
		{
			get
			{
				return this[ "MyDataObject9" ];
			}
		}

		public Microsoft.Office.Interop.InfoPath.SemiTrust.DataObject MyDataObject10
		{
			get
			{
				return this[ "MyDataObject10" ];
			}
		}

		public Microsoft.Office.Interop.InfoPath.SemiTrust.DataObject this[object varIndex] 
		{ 
			get
			{
				if( varIndex is int )
				{
					return (Microsoft.Office.Interop.InfoPath.SemiTrust.DataObject)this.dataObjectList[ (int)varIndex ];
				}
				else
				{
					foreach( DataObject dataObject in this.dataObjectList )
					{
						if( dataObject.Name.Equals( varIndex ) )
						{
							return dataObject;
						}
					}
					return null;
				}
			} 
		}

	}
}
